Skip to content

fix: removed require webpack#89

Merged
chenjiahan merged 2 commits intomainfrom
remove_require_webpack_0228
Feb 28, 2026
Merged

fix: removed require webpack#89
chenjiahan merged 2 commits intomainfrom
remove_require_webpack_0228

Conversation

@chenjiahan
Copy link
Member

  • Removed require webpack
  • Replaced all instances of compiler.webpack with compiler.rspack
  • Updated all test files to use rs instead of rstest

Copilot AI review requested due to automatic review settings February 28, 2026 07:44
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing compatibility with Rspack by eliminating direct Webpack imports and updating references to use the Rspack compiler instance. Additionally, it standardizes the testing utility alias in end-to-end tests, contributing to a more consistent and potentially future-proof codebase.

Highlights

  • Webpack Dependency Removal: The direct require('webpack') call has been removed, streamlining how Webpack-related modules are accessed.
  • Rspack Compatibility Update: All instances of compiler.webpack have been replaced with compiler.rspack to ensure compatibility with Rspack, affecting plugin instantiation and asset processing stages.
  • Test Utility Renaming: The testing utility rstest has been uniformly replaced with rs across all e2e test files, indicating a change in the testing framework or alias.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/server.ts
    • Removed direct require('webpack') statement.
    • Updated webpack.EntryPlugin to compiler.rspack.EntryPlugin.
    • Replaced webpack.ProvidePlugin and webpack.HotModuleReplacementPlugin with compiler.rspack equivalents.
  • tests/e2e/api.test.js
    • Replaced rstest.resetModules() with rs.resetModules().
    • Replaced rstest.fn() with rs.fn() for mock functions.
  • tests/e2e/history-api-fallback.test.js
    • Replaced rstest.spyOn() with rs.spyOn() for console logging.
  • tests/e2e/hot-and-live-reload.test.js
    • Updated commented-out loggerWarnSpy assignment from rstest.fn() to rs.fn().
  • tests/e2e/overlay.test.js
    • Replaced rstest.fn() with rs.fn() for mockLaunchEditorCb.
  • tests/e2e/server.test.js
    • Replaced rstest.spyOn() with rs.spyOn() for https.createServer, spdy.createServer, and customHTTP.createServer.
  • tests/e2e/setup-exit-signals.test.js
    • Replaced rstest.spyOn() with rs.spyOn() for process.exit, process.stdin.resume, server.stopCallback, and server.compiler.close.
  • tests/e2e/static-directory.test.js
    • Replaced rstest.spyOn() with rs.spyOn() for process.cwd.
  • tests/e2e/stats.test.js
    • Replaced rstest.fn() with rs.fn() for global.console.log.
  • tests/e2e/watch-files.test.js
    • Replaced rstest.spyOn() with rs.spyOn() for chokidar.watch.
  • tests/e2e/web-socket-communication.test.js
    • Replaced rstest.setConfig() with rs.setConfig().
  • tests/fixtures/lazy-compilation-multiple-entries/webpack.config.js
    • Updated compiler.webpack.sources to compiler.rspack.sources.
    • Updated compiler.webpack.Compilation to compiler.rspack.Compilation.
  • tests/fixtures/lazy-compilation-single-entry/webpack.config.js
    • Updated compiler.webpack.sources to compiler.rspack.sources.
    • Updated compiler.webpack.Compilation to compiler.rspack.Compilation.
  • tests/helpers/html-generator-plugin.js
    • Updated compiler.webpack.sources to compiler.rspack.sources.
    • Updated compiler.webpack.Compilation to compiler.rspack.Compilation.
  • tests/helpers/trusted-types-html-generator-plugin.js
    • Updated conditional check from compiler.webpack to compiler.rspack.
    • Updated compiler.webpack.sources to compiler.rspack.sources.
    • Updated compiler.webpack.Compilation to compiler.rspack.Compilation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly removes the dynamic require('webpack') and migrates to using compiler.rspack. The updates in the test files to replace rstest with rs are also good. I've left a couple of comments on missed renames for consistency.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the runtime require('webpack') fallback and standardizes on Rspack’s compiler namespace (compiler.rspack) across server internals and test helper plugins, while updating the test suite to use the newer rs test-runner global instead of rstest.

Changes:

  • Remove require('webpack') usage in src/server.ts and use compiler.rspack for EntryPlugin, ProvidePlugin, and HMR plugin handling.
  • Update test helper plugins/fixtures to use compiler.rspack.sources and compiler.rspack.Compilation constants.
  • Migrate e2e tests from rstest.* to rs.* for mocks/spies/config.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/helpers/trusted-types-html-generator-plugin.js Switches asset emission path to use compiler.rspack APIs when available.
tests/helpers/html-generator-plugin.js Uses compiler.rspack.sources / compiler.rspack.Compilation for emitting HTML assets.
tests/fixtures/lazy-compilation-single-entry/webpack.config.js Updates fixture plugin to use compiler.rspack asset APIs.
tests/fixtures/lazy-compilation-multiple-entries/webpack.config.js Updates fixture plugin to use compiler.rspack asset APIs.
tests/e2e/web-socket-communication.test.js Migrates rstest.setConfig to rs.setConfig.
tests/e2e/watch-files.test.js Migrates spy helper from rstest to rs.
tests/e2e/stats.test.js Migrates mock helper from rstest to rs.
tests/e2e/static-directory.test.js Migrates spy helper from rstest to rs in the edited block.
tests/e2e/setup-exit-signals.test.js Migrates several spies to rs (but leaves one rstest usage).
tests/e2e/server.test.js Migrates spy helper from rstest to rs.
tests/e2e/overlay.test.js Migrates mock helper from rstest to rs.
tests/e2e/hot-and-live-reload.test.js Updates commented-out mock helper to rs (but leaves other rstest in comments).
tests/e2e/history-api-fallback.test.js Migrates spy helper from rstest to rs.
tests/e2e/api.test.js Migrates resetModules/mock helpers from rstest to rs.
src/server.ts Removes require('webpack') fallback; uses compiler.rspack plugin constructors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenjiahan chenjiahan merged commit 9e10845 into main Feb 28, 2026
4 checks passed
@chenjiahan chenjiahan deleted the remove_require_webpack_0228 branch February 28, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants